<template>
  <div>
    <FilterTable
      ref="table"
      :columns="columns"
      columnsRef="TranslateItems"
      :fetchapi="fetchApi"
      :params="fetchParams"
      height="200"
      selectionType="single"
      :datakey="'rows'"
      :onColumnsChange="columns => (this.columns = columns)"
      :onRowSelectChange="arr => (this.onChangeColumn = arr)"
    >
      <!-- <template slot="controls">
        <el-button type="primary" @click="handleOnloneSearch">实时查询</el-button>
      </template> -->
    </FilterTable>
    <div class="btnWrap">
      <el-button @click="$emit('close')">取 消</el-button>
    </div>
  </div>
</template>
<script>
import { partgetfourDataItems } from '@/api/part/partInventory/partInventory/index.js';

export default {
  props: ['formdata'],
  data() {
    return {
      onChangeColumn: [],
      isShowItems: false,
      columns: this.createColumns(),
      fetchApi: partgetfourDataItems,
      fetchParams: {
        orderNo: this.formdata.BSYSDH,
        xhrAbort: false
      }
    };
  },
  methods: {
    createColumns() {
      return [
        {
          title: '序号',
          sorter: true,
          width: 70,
          dataIndex: 'xuhao',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '配件代码',
          sorter: true,
          dataIndex: 'partNo'
        },
        {
          title: '配件名称',
          sorter: true,
          dataIndex: 'partName'
        },
        {
          title: '单位',
          sorter: true,
          dataIndex: 'unit'
        },
        {
          title: '发运数量',
          sorter: true,
          dataIndex: 'bsfysl'
        },
        {
          title: '实际到达数量',
          sorter: true,
          dataIndex: 'bssjsl'
        },
        {
          title: '原始单据号',
          sorter: true,
          dataIndex: 'bsddwj'
        }
      ];
    }
  }
};
</script>

<style scoped>
.btnWrap {
  position: absolute;
  left: 0px;
  bottom: 0px;
  right: 0px;
  z-index: 9;
  border-top: 1px solid rgb(233, 233, 233);
  padding: 10px 20px;
  background: rgb(255, 255, 255);
  text-align: right;
}
</style>
